<?php
/**
 * Created by PhpStorm.
 * User: sunzexin
 * Date: 2018/2/14
 * Time: 20:48
 */

namespace App\Http\Logics\MiniProgramAdmin;

use App\WechatArticle;
use App\Http\Logics\BaseLogic;

class ArticleLogic extends BaseLogic
{
    public static function getArticleList($data)
    {
        $query = WechatArticle::with(['partner']);
        $article = $data['limit'] ? $query->paginate($data['limit']) : $query->get();
        if (empty($article)){
            return self::response(self::CONTENT_IS_EMPTY);
        }
        return self::response(self::SUCCESS, $article);
    }

    public static function getArticleDetail($data)
    {
        $article = WechatArticle::find($data['article_id']);
        if (empty($article)){
            return self::response(self::CONTENT_IS_EMPTY);
        }
        return self::response(self::SUCCESS, $article);
    }
}